﻿//UserInfo for store user information
//author: Alexis 2011-06-25
//blog: http://www.cnblogs.com/alexis/
using MvvmLight;
using System;

namespace AccountHelper.Model
{
    public static class UserInfo
    {
        public static User userInfo { get; set; }
    }

    public class User:ViewModelBase
    {
        private string _username;
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName 
        {
            get
            {
                return _username;
            }
            set
            {
                _username=value;
                RaisePropertyChanged(() => UserName);
            }
        }

        private double _curCost;
        /// <summary>
        /// 当月支出 正数
        /// </summary>
        public double CurCost 
        {
            get
            {
                return _curCost;
            }
            set
            {
                _curCost=value;
                RaisePropertyChanged(() => CurCost);
                RaisePropertyChanged(() => CurTotal);
            }
        }

        private double _curCharge;
        /// <summary>
        /// 当月收入 正数
        /// </summary>
        public double CurCharge 
        {
            get
            {
                return _curCharge;
            }
            set
            {
                _curCharge=value;
                RaisePropertyChanged(() => CurCharge);
                RaisePropertyChanged(() => CurTotal);
            }
        }

        /// <summary>
        /// 用户头像
        /// </summary>
        private Uri profileImageUri;
        public Uri ProfileImageUri
        {
            get
            {
                return profileImageUri;
            }
            set
            {
                profileImageUri = value;
                RaisePropertyChanged(() => ProfileImageUri);
            }
        }

        /// <summary>
        /// 当月合计
        /// </summary>
        public double CurTotal { get { return CurCharge - CurCost; } }

        /// <summary>
        /// 当前年月
        /// </summary>
        public string CurYearMonth { get; set; }
    }
}
